import Vue from 'vue'
import Vuex from 'vuex'
Vue.use(Vuex)
var defaultCity = "上海"
try{
	if(localStorage.city){
		defaultCity = localStorage.city
	}
} catch (e){
	
}
export default new Vuex.Store({
	state: {
		city:defaultCity
	},
	actions:{
		changeCity:function(el,city){			
			el.commit("changeCity",city)
		}
	},
	mutations:{
		changeCity:function(state,city){
			state.city = city
			try{
				localStorage.city = city
			}catch (e){
				
			}
			
		}
	}
})
